<!--
 * @Author: your name
 * @Date: 2021-05-27 23:43:19
 * @LastEditTime: 2021-05-31 15:42:36
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \tourismpc\src\views\tourism\components\famousHotel\homeDetail\index.vue
-->
<template>
  <div class="homeDetail">
    <div>
      <div class="tipsPrice">
        <div class="keyWord">
          <h3 style="color: #333333">{{roomInfo.roomName}}</h3>
        </div>
        <div>
          <span class="set"></span>
          <span class="price">{{roomInfo.roomPrice}}RMB</span>起
        </div>
      </div>
      <el-divider></el-divider>
      <div class="homeImg">
        <img style="width: 100%; height: 100%" :src="roomInfo.roomImgUrl" alt />
      </div>
      <div class="text">
        <div class="titleText">基本信息</div>
        <br />
        <div class="tips">
          <div class="tipItem">
            <img src="../../../../../assets/imgs/面积.png" alt />
            面积：{{roomInfo.roomArea}}㎡
          </div>
          <div class="tipItem">
            <img src="../../../../../assets/imgs/床型.png" alt />
            床型：{{roomInfo.bedType}}
          </div>
          <div class="tipItem">
            <img src="../../../../../assets/imgs/早餐.png" alt />
            早餐：{{roomInfo.breakfast}}
          </div>
          <div class="tipItem">
            <img src="../../../../../assets/imgs/网络.png" alt />
            WiFi：{{roomInfo.roomWifi}}
          </div>
          <div class="tipItem">
            <img src="../../../../../assets/imgs/价格.png" alt />
            {{roomInfo.roomPrice}}RMB/晚
          </div>
        </div>
      </div>
      <div class="text">
        <div class="titleText">房型描述</div>
        <br />
        <div style="text-indent: 2em">{{roomInfo.roomInfor}}</div>
      </div>
      <div class="buyTicket">
        <div class="buyButton">立即预定</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "HomeDetail",
  data() {
    return {
      api: this.$apiPath.getRoomInfo,
      roomInfo: {},
    };
  },
  created() {
    this.getRoomInfo();
  },
  methods: {
    getRoomInfo(roomId) {
      let that = this;
      document.body.scrollTop = 0;
      document.documentElement.scrollTop = 0;
      this.$http
        .fetch(
          `${this.api}?roomId=${roomId ? roomId : this.$route.query.roomId}`,
          {
            method: "get",
          }
        )
        .then((res) => {
          if (res.code === 200) {
            this.roomInfo = res.data;
          }
        })
        .catch((err) => {
          return Promise.reject(err);
        });
    },
  },
};
</script>

<style lang="less">
.homeDetail {
  width: 1220px;
  margin: 0 auto;
  .tipsPrice {
    overflow: hidden;
    color: #999999;
    div {
      &:nth-child(1) {
        float: left;
      }
      &:nth-child(2) {
        float: right;
        .set {
          display: inline-block;
          width: 1px;
          height: 40px;
          background: #999999;
          margin-right: 16px;
        }
      }
    }
    .price {
      font-size: 36px;
      color: #f44a22;
      margin-bottom: -4px;
    }
    .keyWord {
      height: 46px;
      line-height: 46px;
      color: #333333;
    }
  }
  .text {
    color: #666666;
  }
  .homeImg {
    width: 713px;
    height: 418px;
    margin: 0 auto;
  }
  .tips {
    display: flex;
    flex-wrap: wrap;
    width: 870px;
    .tipItem {
      width: 287px;
      font-size: 14px;
      color: #666666;
      display: flex;
      align-items: center;
      margin-bottom: 56px;
      img {
        margin-right: 20px;
      }
      &:nth-child(4) {
        margin-bottom: 33px;
      }
      &:nth-child(5) {
        margin-bottom: 33px;
      }
    }
  }
  .buyTicket {
    margin: 50px 0;
    .buyButton {
      cursor: pointer;
      width: 128px;
      height: 36px;
      background-color: #cf975a;
      border-radius: 18px;
      text-align: center;
      line-height: 36px;
      margin: 0 auto;
      color: #fff;
    }
  }
}
</style>